angular.module("myApp")
.controller("SearchController", ["$scope","$location","mySearchService","mySearchDetailsService","mySearchDetailsWenService","mySearchDetailsShopService","mySearchDetailsAdminService","mySearchDetailsJinService","mySearchDetailsTieService", function($scope,$location,mySearchService,mySearchDetailsService,mySearchDetailsWenService,mySearchDetailsShopService,mySearchDetailsAdminService,mySearchDetailsJinService,mySearchDetailsTieService){
	$scope.search_jump = function(){
		$location.path("/destination");
	} 
	$scope.search_jump1 = function(){
		$location.path("/search/search_Details");
	}
	mySearchService.getData().success(function(res){
        $scope.items = res;        
    });
    mySearchDetailsService.getData().success(function(data1){
		$scope.arrs = data1.data.entry;
    });
    mySearchDetailsWenService.getData().success(function(data2){
        $scope.items1 = data2.data;
    });
    mySearchDetailsShopService.getData().success(function(data5){
        $scope.items_shop = data5.data.entry;
    });
    mySearchDetailsAdminService.getData().success(function(data4){
        $scope.items3 = data4.data.entry;
    })
    mySearchDetailsJinService.getData().success(function(data7){
        $scope.items_jinData = data7.data.entry;
    });
    mySearchDetailsTieService.getData().success(function(data6){
        $scope.items_tiezi = data6.data.entry;
    });
    $scope.search_Details_click = function($event){
    	var str = $event.target;
    	var spanEle = document.getElementsByTagName('span');
		for (var i = 0; i < spanEle.length; i++) {
			spanEle[i].className="search_Details_classB";
		};
    	switch(str.innerText){
    		case "目的地":
    			str.className="search_Details_classA";
    			break;
    		case "锦囊":
    			str.className="search_Details_classA";
    			break;
    		case "问答":
    			str.className="search_Details_classA";
    			break;
    		case "帖子":
    			str.className="search_Details_classA";
    			break;
    		case "商品":
    			str.className="search_Details_classA";
    			break;
    		case "用户":
    			str.className="search_Details_classA";
    			break;
    		default:
    			break;
    	}
    }
}])